<template>
<el-tooltip class="item" effect="dark" content="刷新" placement="top">
    <el-button circle icon="Refresh" @click="update" />
  </el-tooltip>
  <el-table
    :data="WaitAssessorList"
    style="width: 95%; margin: 20px"
    size="large"
  >
    <el-table-column prop="empName" label="员工姓名" width="150">
      <template #default="scope">
        <el-tooltip content="详情" placement="top-start" effect="light">
          <a style="text-decoration: none; color: black">
            {{ scope.row.empName }}
          </a>
        </el-tooltip>
      </template>
    </el-table-column>
    <el-table-column prop="position" label="岗位" width="180"></el-table-column>
    <el-table-column prop="deptName" label="所属单元" width="120" />
    <el-table-column label="操作">
      <template #default="scope">
        <el-button type="success" @click="onShowClick(scope.$index, scope.row)"
          >重新填写</el-button
        >
      </template>
    </el-table-column>
  </el-table>
</template>


<script setup>
import { ref, onMounted, onBeforeMount, reactive } from "vue";
import { Timer } from "@element-plus/icons-vue";
import { useRouter } from "vue-router";
import { getBackFourthOkr } from "@/api/task";
import { ElMessage } from 'element-plus'

const router = useRouter();

const WaitAssessorList = ref([]);
let empId = JSON.parse(localStorage.getItem("userInfo")).id;
onBeforeMount(() => {
  getBackFourthOkr({ empId }).then((data) => {
    WaitAssessorList.value = data.data;
  });
});

const onShowClick = (index, row) => {
  router.push({
    path: "/back/fourthOkr",
    query: row,
  });
};

const update = () => {
  getBackFourthOkr({ empId }).then((data) => {
    if (data.code == 200) {
      ElMessage({
        message: "更新成功",
        type: "success",
      });
      WaitAssessorList.value = data.data;
    } else {
      ElMessage.error("更新失败");
    }
  });
};
</script>

<style lang="scss" scoped>
</style>
